﻿# Make sure the weights here match up best as possible with the custom_beards set
beards = {

	usage = game

    selection_behavior = weighted_random

	no_beard_for_children = {
        dna_modifiers = {
            accessory = {
                mode = add
                gene = beards
                template = no_beard
                range = { 0 1 } # For the randomness to work correctly
            }
        }   
        weight = {
            base = 0
            modifier = {
                add = 100
                scope:age < 18
            }
        }
    }

    has_no_beard = { # This is to give a random chance of a clean shaven look
        dna_modifiers = {
            accessory = {
                mode = add
                gene = beards
                template = no_beard
                range = { 0 1 } # For the randomness to work correctly
            }
        }   
        weight = {
            base = 30 
            modifier = {
                add = -50
                exists = this
                OR = {
                    is_from_ruler_designer = yes
                    has_character_flag = has_scripted_appearance
                }
            }
			modifier = {
				add = 666
				exists = this
				exists = character:easteregg_daan_broekhof
				this = character:easteregg_daan_broekhof
			}
			modifier = {
				add = 1000
				exists = this
				has_character_flag = no_beard
			}
            modifier = {
                add = -20
                exists = this
                portrait_steppe_clothing_trigger = yes
            }
            portrait_clean_shaven_clothing_modifier = yes
        }
    }

    western_straight = {
        dna_modifiers = {
            accessory = {
                mode = add
                gene = beards
                template = western_beards_straight
                range = { 0 1 } # For the randomness to work correctly
            }
        }   
        # outfit_tags = { no_clothes }
        weight = {
            base = 0
            modifier = {
                add = 70
                OR = {
                    NOT = { exists = this }
                    has_gene = {
                        category = gene_hair_type
                        template = hair_straight
                    }       
                    has_gene = {
                        category = gene_hair_type
                        template = hair_wavy
                    }            
                }
                portrait_western_clothing_trigger = yes
            }
            modifier = { # Muslims should always have a beard
                add = 200
                scope:faith.religion = religion:islam_religion
                portrait_western_clothing_trigger = yes
            }
            modifier = {
                add = -100
                exists = this
                OR = {
                    is_from_ruler_designer = yes
                    has_character_flag = has_scripted_appearance
                }
            }
        }
    }

    western_curly = {
        dna_modifiers = {
            accessory = {
                mode = add
                gene = beards
                template = western_beards_curly
                range = { 0 1 } # For the randomness to work correctly
            }
        }   
        # outfit_tags = { no_clothes }
        weight = {
            base = 0
            modifier = {
                add = 70
                OR = {
                    NOT = { exists = this }
                     has_gene = {
                        category = gene_hair_type
                        template = hair_wavy
                    }       
                     has_gene = {
                        category = gene_hair_type
                        template = hair_curly
                    }            
                }
                portrait_western_clothing_trigger = yes
            }
            modifier = { # Muslims should always have a beard
                add = 200
                scope:faith.religion = religion:islam_religion
                portrait_western_clothing_trigger = yes
            }
            modifier = {
                add = -100
                exists = this
                OR = {
                    is_from_ruler_designer = yes
                    has_character_flag = has_scripted_appearance
                }
            }
        }
    }

    mena_straight = {
        dna_modifiers = {
            accessory = {
                mode = add
                gene = beards
                template = mena_beards_straight
                range = { 0 1 } # For the randomness to work correctly
            }
        }   
        # outfit_tags = { no_clothes }
        weight = {
            base = 0
            modifier = {
                add = 70
                OR = {
                    NOT = { exists = this }
                     has_gene = {
                        category = gene_hair_type
                        template = hair_straight
                    }       
                    has_gene = {
                        category = gene_hair_type
                        template = hair_wavy
                    }            
                }
				OR = {
					portrait_mena_clothing_trigger = yes
					portrait_african_clothing_trigger = yes
				}
            }
            modifier = { # Muslims should always have a beard
                add = 200
                scope:faith.religion = religion:islam_religion
                OR = {
					portrait_mena_clothing_trigger = yes
					portrait_african_clothing_trigger = yes
				}
                NAND = { # The Prophet Muhammad does not have a portrait
                    exists = this
                    this = character:33922 # Prophet Muhammad
                }
            }
            modifier = {
                add = -100
                exists = this
                OR = {
                    is_from_ruler_designer = yes
                    has_character_flag = has_scripted_appearance
                    this = character:33922 # Prophet Muhammad
                }
            }
        }
    }

    mena_curly = {
        dna_modifiers = {
            accessory = {
                mode = add
                gene = beards
                template = mena_beards_curly
                range = { 0 1 } # For the randomness to work correctly
            }
        }   
        # outfit_tags = { no_clothes }
        weight = {
            base = 0
            modifier = {
                add = 70
                OR = {
                    NOT = { exists = this }
                     has_gene = {
                        category = gene_hair_type
                        template = hair_wavy
                    }       
                    has_gene = {
                        category = gene_hair_type
                        template = hair_curly
                    }            
                }
                OR = {
					portrait_mena_clothing_trigger = yes
					portrait_african_clothing_trigger = yes
				}
            }
            modifier = { # Muslims should always have a beard
                add = 200
                scope:faith.religion = religion:islam_religion
                OR = {
					portrait_mena_clothing_trigger = yes
					portrait_african_clothing_trigger = yes
				}
                NAND = { # The Prophet Muhammad does not have a portrait
                    exists = this
                    this = character:33922 # Prophet Muhammad
                }
            }
            modifier = {
                add = -100
                exists = this
                OR = {
                    is_from_ruler_designer = yes
                    has_character_flag = has_scripted_appearance
                    this = character:33922 # Prophet Muhammad
                }
            }
        }
    }

    byzantine_straight = {
        dna_modifiers = {
            accessory = {
                mode = add
                gene = beards
                template = byzantine_beards_straight
                range = { 0 1 } # For the randomness to work correctly
            }
        }   
        # outfit_tags = { no_clothes }
        weight = {
            base = 0
            modifier = {
                add = 80
                OR = {
                    NOT = { exists = this }
                    has_gene = {
                        category = gene_hair_type
                        template = hair_straight
                    }       
                    has_gene = {
                        category = gene_hair_type
                        template = hair_wavy
                    }            
                }
                portrait_byzantine_clothing_trigger = yes
            }
            modifier = { # Muslims should always have a beard
                add = 200
                scope:faith.religion = religion:islam_religion
                portrait_byzantine_clothing_trigger = yes
            }
            modifier = {
                add = -100
                exists = this
                OR = {
                    is_from_ruler_designer = yes
                    has_character_flag = has_scripted_appearance
                }
            }
        }
    }

    byzantine_curly = {
        dna_modifiers = {
            accessory = {
                mode = add
                gene = beards
                template = byzantine_beards_curly
                range = { 0 1 } # For the randomness to work correctly
            }
        }   
        # outfit_tags = { no_clothes }
        weight = {
            base = 0
            modifier = {
                add = 80
                OR = {
                    NOT = { exists = this }
                    has_gene = {
                        category = gene_hair_type
                        template = hair_wavy
                    }       
                    has_gene = {
                        category = gene_hair_type
                        template = hair_curly
                    }            
                }
                portrait_byzantine_clothing_trigger = yes
            }
            modifier = { # Muslims should always have a beard
                add = 200
                scope:faith.religion = religion:islam_religion
                portrait_byzantine_clothing_trigger = yes
            }
            modifier = {
                add = -100
                exists = this
                OR = {
                    is_from_ruler_designer = yes
                    has_character_flag = has_scripted_appearance
                }
            }
        }
    }

    indian_straight = {
        dna_modifiers = {
            accessory = {
                mode = add
                gene = beards
                template = indian_beards_straight
                range = { 0 1 } # For the randomness to work correctly
            }
        }   
        # outfit_tags = { no_clothes }
        weight = {
            base = 0
            modifier = {
                add = 70
                OR = {
                    NOT = { exists = this }
                     has_gene = {
                        category = gene_hair_type
                        template = hair_straight
                    }       
                    has_gene = {
                        category = gene_hair_type
                        template = hair_wavy
                    }            
                }
                portrait_indian_clothing_trigger = yes
            }
            modifier = { # Muslims should always have a beard
                add = 200
                scope:faith.religion = religion:islam_religion
                portrait_indian_clothing_trigger = yes
            }
            modifier = {
                add = -100
                exists = this
                OR = {
                    is_from_ruler_designer = yes
                    has_character_flag = has_scripted_appearance
                }
            }
        }
    }

    indian_curly = {
        dna_modifiers = {
            accessory = {
                mode = add
                gene = beards
                template = indian_beards_curly
                range = { 0 1 } # For the randomness to work correctly
            }
        }   
        # outfit_tags = { no_clothes }
        weight = {
            base = 0
            modifier = {
                add = 70
                OR = {
                    NOT = { exists = this }
                     has_gene = {
                        category = gene_hair_type
                        template = hair_wavy
                    }       
                    has_gene = {
                        category = gene_hair_type
                        template = hair_curly
                    }            
                }
                portrait_indian_clothing_trigger = yes
            }
            modifier = { # Muslims should always have a beard
                add = 200
                scope:faith.religion = religion:islam_religion
                portrait_indian_clothing_trigger = yes
            }
            modifier = {
                add = -100
                exists = this
                OR = {
                    is_from_ruler_designer = yes
                    has_character_flag = has_scripted_appearance
                }
            }
        }
    }

    thin_beards = {
        dna_modifiers = {
            accessory = {
                mode = add
                gene = beards
                template = thin_beards_straight
                range = { 0 1 } # For the randomness to work correctly
            }
        }   
        # outfit_tags = { no_clothes }
        weight = {
            base = 0
            modifier = {
                add = 70
                exists = this
                has_gene = {
                    category = gene_hair_type
                    template = hair_straight_thin_beard
                }
            }
            modifier = { # Muslims should always have a beard
                add = 200
                scope:faith.religion = religion:islam_religion
                trigger_if = {
                    limit = { exists = this }
                    has_gene = {
                        category = gene_hair_type
                        template = hair_straight_thin_beard
                    }
                }
            }
            modifier = {
                add = -100
                exists = this
                OR = {
                    is_from_ruler_designer = yes
                    has_character_flag = has_scripted_appearance
                }
            }
        }
    }

    steppe_straight = {
        dna_modifiers = {
            accessory = {
                mode = add
                gene = beards
                template = steppe_beards_straight
                range = { 0 1 } # For the randomness to work correctly
            }
        }   
        # outfit_tags = { no_clothes }
        weight = {
            base = 0
            modifier = {
                add = 50
                OR = {
                    NOT = { exists = this }
                     has_gene = {
                        category = gene_hair_type
                        template = hair_straight
                    }       
                    has_gene = {
                        category = gene_hair_type
                        template = hair_wavy
                    }            
                }
                portrait_steppe_clothing_trigger = yes
            }
            modifier = { # Muslims should always have a beard
                add = 200
                scope:faith.religion = religion:islam_religion
                portrait_steppe_clothing_trigger = yes
            }
            modifier = {
                add = -100
                exists = this
                OR = {
                    is_from_ruler_designer = yes
                    has_character_flag = has_scripted_appearance
                }
            }
        }
    }

    mpo_mongol_straight = {
        dna_modifiers = {
            accessory = {
                mode = add
                gene = beards
                template = mpo_mongol_beards
                range = { 0 1 } # For the randomness to work correctly
            }
        }   
        # outfit_tags = { no_clothes }
        weight = {
            base = 0
            modifier = {
                add = 50
                OR = {
                    NOT = { exists = this }
                    # has_gene = {
                    #     category = gene_hair_type
                    #     template = hair_straight
                    # }  
                    has_gene = {
                        category = gene_hair_type
                        template = hair_straight_thin_beard
                    }      
                    # has_gene = {
                    #     category = gene_hair_type
                    #     template = hair_wavy
                    # }            
                }
                portrait_steppe_clothing_trigger = yes
                has_mpo_dlc_trigger = yes 
            }
            modifier = { # Muslims should always have a beard
                add = 200
                scope:faith.religion = religion:islam_religion
                portrait_steppe_clothing_trigger = yes
            }
            modifier = {
                add = -100
                exists = this
                OR = {
                    is_from_ruler_designer = yes
                    has_character_flag = has_scripted_appearance
                }
            }
        }
    }

    steppe_curly = {
        dna_modifiers = {
            accessory = {
                mode = add
                gene = beards
                template = steppe_beards_curly
                range = { 0 1 } # For the randomness to work correctly
            }
        }   
        # outfit_tags = { no_clothes }
        weight = {
            base = 0
            modifier = {
                add = 50
                OR = {
                    NOT = { exists = this }
                     has_gene = {
                        category = gene_hair_type
                        template = hair_wavy
                    }       
                    has_gene = {
                        category = gene_hair_type
                        template = hair_curly
                    }            
                }
                portrait_steppe_clothing_trigger = yes
            }
            modifier = { # Muslims should always have a beard
                add = 200
                scope:faith.religion = religion:islam_religion
                portrait_steppe_clothing_trigger = yes
            }
            modifier = {
                add = -100
                exists = this
                OR = {
                    is_from_ruler_designer = yes
                    has_character_flag = has_scripted_appearance
                }
            }
        }
    }

    northern_straight = {
        dna_modifiers = {
            accessory = {
                mode = add
                gene = beards
                template = northern_beards_straight
                range = { 0 1 } # For the randomness to work correctly
            }
        }   
        # outfit_tags = { no_clothes }
        weight = {
            base = 0
            modifier = {
                add = 50
                OR = {
                    NOT = { exists = this }
                     has_gene = {
                        category = gene_hair_type
                        template = hair_straight
                    }       
                    has_gene = {
                        category = gene_hair_type
                        template = hair_wavy
                    }            
                }
                OR = {
                    portrait_northern_clothing_trigger = yes
                    portrait_sami_clothing_trigger = yes
                }
            }
            modifier = { # Muslims should always have a beard
                add = 200
                scope:faith.religion = religion:islam_religion
                OR = {
                    portrait_northern_clothing_trigger = yes
                    portrait_sami_clothing_trigger = yes
                }
            }
            modifier = {
                add = -100
                exists = this
                OR = {
                    is_from_ruler_designer = yes
                    has_character_flag = has_scripted_appearance
                }
            }
        }
    }

    northern_curly = {
        dna_modifiers = {
            accessory = {
                mode = add
                gene = beards
                template = northern_beards_curly
                range = { 0 1 } # For the randomness to work correctly
            }
        }   
        # outfit_tags = { no_clothes }
        weight = {
            base = 0
            modifier = {
                add = 90
                OR = {
                    NOT = { exists = this }
                    has_gene = {
                        category = gene_hair_type
                        template = hair_wavy
                    }       
                    has_gene = {
                        category = gene_hair_type
                        template = hair_curly
                    }            
                }
                OR = {
                    portrait_northern_clothing_trigger = yes
                    portrait_sami_clothing_trigger = yes
                }
            }
            modifier = { # Muslims should always have a beard
                add = 200
                scope:faith.religion = religion:islam_religion
                OR = {
                    portrait_northern_clothing_trigger = yes
                    portrait_sami_clothing_trigger = yes
                }
            }
            modifier = {
                add = -100
                exists = this
                OR = {
                    is_from_ruler_designer = yes
                    has_character_flag = has_scripted_appearance
                }
            }
        }
    }

    african = {
        dna_modifiers = {
            accessory = {
                mode = add
                gene = beards
                template = sub_saharan_beards_afro
                range = { 0 1 } # For the randomness to work correctly
            }
        }   
        # outfit_tags = { no_clothes }
        weight = {
            base = 0
            modifier = {
                add = 70
                exists = this
                 has_gene = {
                    category = gene_hair_type
                    template = hair_afro
                }              
            }
            modifier = { # Muslims should always have a beard
                add = 200
                scope:faith.religion = religion:islam_religion
                portrait_african_clothing_trigger = yes
            }
            modifier = {
                add = -100
                exists = this
                OR = {
                    is_from_ruler_designer = yes
                    has_character_flag = has_scripted_appearance
                }
            }
        }
    }

	### SP2 - Elegance of the Empire ###

	sp2_beards_straight = {
        dna_modifiers = {
            accessory = {
                mode = add
                gene = beards
                template = sp2_beards_straight
                range = { 0 1 } # For the randomness to work correctly
            }
        }
        weight = {
            base = 0
            modifier = {
                add = 4
                OR = {
                    NOT = { exists = this }
                    has_gene = {
                    	category = gene_hair_type
                    	template = hair_straight
                    }       
                    has_gene = {
                    	category = gene_hair_type
                    	template = hair_wavy
                    }            
                }
				OR = {
					portrait_sp2_western_clothing_trigger = yes 
				}
            }
            modifier = { # Muslims should always have a beard
                add = 200
                scope:faith.religion = religion:islam_religion
                OR = {
					portrait_sp2_western_clothing_trigger = yes
				}
            }
            modifier = {
                add = -100
                exists = this
                OR = {
                    is_from_ruler_designer = yes
                    has_character_flag = has_scripted_appearance
                }
            }
        }
    }

    ### FP3 Beards ###

    #iranian
    fp3_iranian_beards_straight = {
        dna_modifiers = {
            accessory = {
                mode = add
                gene = beards
                template = fp3_iranian_beards_straight
                range = { 0 1 } # For the randomness to work correctly
            }
        }   
    # outfit_tags = { no_clothes }
        weight = {
            base = 0
            modifier = {
                add = 70
                OR = {
                    NOT = { exists = this }
                     has_gene = {
                        category = gene_hair_type
                        template = hair_straight
                    }       
                    has_gene = {
                        category = gene_hair_type
                        template = hair_wavy
                    }            
                }
                portrait_fp3_iranian_clothing_trigger = yes
            }
            modifier = { # Muslims should always have a beard
                add = 200
                scope:faith.religion = religion:islam_religion
                portrait_fp3_iranian_clothing_trigger = yes
            }
            modifier = {
                add = -100
                exists = this
                OR = {
                    is_from_ruler_designer = yes
                    has_character_flag = has_scripted_appearance
                }
            }
        }
    }

    fp3_iranian_beards_curly = {
        dna_modifiers = {
            accessory = {
                mode = add
                gene = beards
                template = fp3_iranian_beards_curly
                range = { 0 1 } # For the randomness to work correctly
            }
        }   
        # outfit_tags = { no_clothes }
        weight = {
            base = 0
            modifier = {
                add = 70
                OR = {
                    NOT = { exists = this }
                     has_gene = {
                        category = gene_hair_type
                        template = hair_wavy
                    }       
                    has_gene = {
                        category = gene_hair_type
                        template = hair_curly
                    }            
                }
                portrait_fp3_iranian_clothing_trigger = yes
            }
            modifier = { # Muslims should always have a beard
                add = 200
                scope:faith.religion = religion:islam_religion
                portrait_fp3_iranian_clothing_trigger = yes
            }
            modifier = {
                add = -100
                exists = this
                OR = {
                    is_from_ruler_designer = yes
                    has_character_flag = has_scripted_appearance
                }
            }
        }
    }

    #turkic
    fp3_turkic_beards_straight = {
        dna_modifiers = {
            accessory = {
                mode = add
                gene = beards
                template = fp3_turkic_beards_straight
                range = { 0 1 } # For the randomness to work correctly
            }
        }   
        # outfit_tags = { no_clothes }
        weight = {
            base = 0
            modifier = {
                add = 50
                OR = {
                    NOT = { exists = this }
                     has_gene = {
                        category = gene_hair_type
                        template = hair_straight
                    }       
                    has_gene = {
                        category = gene_hair_type
                        template = hair_wavy
                    }            
                }
                portrait_fp3_turkic_clothing_trigger = yes
            }
            modifier = { # Muslims should always have a beard
                add = 200
                scope:faith.religion = religion:islam_religion
                portrait_fp3_turkic_clothing_trigger = yes
            }
            modifier = {
                add = -100
                exists = this
                OR = {
                    is_from_ruler_designer = yes
                    has_character_flag = has_scripted_appearance
                }
            }
        }
    }

    fp3_turkic_beards_curly = {
        dna_modifiers = {
            accessory = {
                mode = add
                gene = beards
                template = fp3_turkic_beards_curly
                range = { 0 1 } # For the randomness to work correctly
            }
        }   
        # outfit_tags = { no_clothes }
        weight = {
            base = 0
            modifier = {
                add = 50
                OR = {
                    NOT = { exists = this }
                     has_gene = {
                        category = gene_hair_type
                        template = hair_wavy
                    }       
                    has_gene = {
                        category = gene_hair_type
                        template = hair_curly
                    }            
                }
                portrait_fp3_turkic_clothing_trigger = yes
            }
            modifier = { # Muslims should always have a beard
                add = 200
                scope:faith.religion = religion:islam_religion
                portrait_fp3_turkic_clothing_trigger = yes
            }
            modifier = {
                add = -100
                exists = this
                OR = {
                    is_from_ruler_designer = yes
                    has_character_flag = has_scripted_appearance
                }
            }
        }
    }

    ### FP2 Beards ###

    fp2_beards_straight = {
        dna_modifiers = {
            accessory = {
                mode = add
                gene = beards
                template = fp2_beards_straight
                range = { 0 1 } # For the randomness to work correctly
            }
        }   
        weight = {
            base = 0
            modifier = {
                add = 70
                OR = {
                    NOT = { exists = this }
                     has_gene = {
                        category = gene_hair_type
                        template = hair_straight
                    }       
                    has_gene = {
                        category = gene_hair_type
                        template = hair_wavy
                    }            
                }
				OR = {
					portrait_fp2_iberian_muslim_clothing_trigger = yes
					portrait_fp2_iberian_christian_clothing_trigger = yes
				}
            }
            modifier = { # Muslims should always have a beard
                add = 200
                scope:faith.religion = religion:islam_religion
                OR = {
					portrait_fp2_iberian_muslim_clothing_trigger = yes
					portrait_fp2_iberian_christian_clothing_trigger = yes
				}
            }
            modifier = {
                add = -100
                exists = this
                OR = {
                    is_from_ruler_designer = yes
                    has_character_flag = has_scripted_appearance
                }
            }
        }
    }

    fp2_beards_curly = {
        dna_modifiers = {
            accessory = {
                mode = add
                gene = beards
                template = fp2_beards_curly
                range = { 0 1 } # For the randomness to work correctly
            }
        }   
        weight = {
            base = 0
            modifier = {
                add = 70
                OR = {
                    NOT = { exists = this }
                     has_gene = {
                        category = gene_hair_type
                        template = hair_wavy
                    }       
                    has_gene = {
                        category = gene_hair_type
                        template = hair_curly
                    }            
                }
                OR = {
					portrait_fp2_iberian_muslim_clothing_trigger = yes
					portrait_fp2_iberian_christian_clothing_trigger = yes
				}
            }
            modifier = { # Muslims should always have a beard
                add = 200
                scope:faith.religion = religion:islam_religion
                OR = {
					portrait_fp2_iberian_muslim_clothing_trigger = yes
					portrait_fp2_iberian_christian_clothing_trigger = yes
				}
            }
            modifier = {
                add = -100
                exists = this
                OR = {
                    is_from_ruler_designer = yes
                    has_character_flag = has_scripted_appearance
                }
            }
        }
    }

    ### FP1 Beards ###

    fp1_straight = {
        dna_modifiers = {
            accessory = {
                mode = add
                gene = beards
                template = fp1_beards_straight
                range = { 0 1 } # For the randomness to work correctly
            }
        }   
        # outfit_tags = { no_clothes }
        weight = {
            base = 0
            modifier = {
                add = 90
                OR = {
                    NOT = { exists = this }
                     has_gene = {
                        category = gene_hair_type
                        template = hair_straight
                    }       
                    has_gene = {
                        category = gene_hair_type
                        template = hair_wavy
                    }            
                }
                portrait_fp1_norse_clothing_trigger = yes
            }
            modifier = { # Muslims should always have a beard
                add = 200
                scope:faith.religion = religion:islam_religion
                portrait_fp1_norse_clothing_trigger = yes
            }
            modifier = {
                add = -100
                exists = this
                OR = {
                    is_from_ruler_designer = yes
                    has_character_flag = has_scripted_appearance
                }
            }
        }
    }

    fp1_curly = {
        dna_modifiers = {
            accessory = {
                mode = add
                gene = beards
                template = fp1_beards_curly
                range = { 0 1 } # For the randomness to work correctly
            }
        }   
        # outfit_tags = { no_clothes }
        weight = {
            base = 0
            modifier = {
                add = 70
                OR = {
                    NOT = { exists = this }
                     has_gene = {
                        category = gene_hair_type
                        template = hair_wavy
                    }       
                    has_gene = {
                        category = gene_hair_type
                        template = hair_curly
                    }            
                }
                portrait_fp1_norse_clothing_trigger = yes
            }
            modifier = { # Muslims should always have a beard
                add = 200
                scope:faith.religion = religion:islam_religion
                portrait_northern_clothing_trigger = yes
            }
            modifier = {
                add = -100
                exists = this
                OR = {
                    is_from_ruler_designer = yes
                    has_character_flag = has_scripted_appearance
                }
            }
        }
    }

    orthodox_beards = {
        dna_modifiers = {
            accessory = {
                mode = add
                gene = beards
                template = orthodox_beards
                range = { 0 1 } # For the randomness to work correctly
            }
        }   
        weight = {
            base = 0
            modifier = { # Orthodox priests
                add = 200
                exists = this
                OR = {
                    has_character_flag = need_priest_outfit
                    is_theocratic_lessee = yes
                    AND = { is_ruler = yes government_has_flag = government_is_theocracy }
                    AND = { # Orthodox patriarch
                        exists = primary_title
                        primary_title = {
                            any_controlled_faith = {
                                this = faith:orthodox
                            }
                        }                    
                    }
                }
                OR = {
                    faith = faith:orthodox
                    faith = faith:armenian_apostolic
                    faith = faith:coptic
                    faith = faith:messalian
                    faith = faith:bogomilist
                    faith = faith:paulician
                    faith = faith:nestorian
                }
            }
        }
    }

    ultimate_beards = {
        dna_modifiers = {
            accessory = {
                mode = add
                gene = beards
                template = rtt_beards
                range = { 0 1 } # For the randomness to work correctly
            }
        }   
        weight = {
            base = 0
            modifier = {
                add = 2000
                exists = this
				OR = {
					has_nickname = nick_the_beautiful_beard
					has_nickname = nick_the_bearded
					has_character_flag = mystic_beard_var
				}
            }
        }
    }

    ### EP2 beards ###

    ep2_beards_straight = {
        dna_modifiers = {
            accessory = {
                mode = add
                gene = beards
                template = ep2_beards
                range = { 0 1 } # For the randomness to work correctly
            }
        }   
        weight = {
            base = 0
            modifier = {
                add = 55
                OR = {
                    NOT = { exists = this }
                    has_gene = {
                        category = gene_hair_type
                        template = hair_straight
                    }
                    has_gene = {
                        category = gene_hair_type
                        template = hair_wavy
                    }
                }
                portrait_western_clothing_trigger = yes
                has_ep2_dlc_trigger = yes
            }
            modifier = {
                add = 20
                portrait_era1_trigger = yes
            }
            modifier = {
                add = -20
                portrait_era2_trigger = yes
            }
            modifier = {
                add = -40
                OR = {
                    portrait_era3_trigger = yes
                    portrait_era4_trigger = yes
                }                
            }
            modifier = {
                factor = 0
                portrait_western_clothing_trigger = no
            }
        }
    }

    ### EP3 beards ###

    ep3_beards_straight = {
        dna_modifiers = {
            accessory = {
                mode = add
                gene = beards
                template = ep3_beards_straight
                range = { 0 1 } # For the randomness to work correctly
            }
        }   
        weight = {
            base = 0
            modifier = {
                add = 75
                OR = {
                    NOT = { exists = this }
                    has_gene = {
                        category = gene_hair_type
                        template = hair_straight
                    }
                    has_gene = {
                        category = gene_hair_type
                        template = hair_wavy
                    }
                }
                portrait_byzantine_clothing_trigger = yes
                has_ep3_dlc_trigger = yes
            }
        }
    }

    ep3_beards_curly = {
        dna_modifiers = {
            accessory = {
                mode = add
                gene = beards
                template = ep3_beards_curly
                range = { 0 1 } # For the randomness to work correctly
            }
        }   
        weight = {
            base = 0
            modifier = {
                add = 75
                OR = {
                    NOT = { exists = this }
                    has_gene = {
                        category = gene_hair_type
                        template = hair_wavy
                    }
                    has_gene = {
                        category = gene_hair_type
                        template = hair_curly
                    }
                }
                portrait_byzantine_clothing_trigger = yes
                has_ep3_dlc_trigger = yes
            }
        }
    }

    ### SP4 - Crowns of the World ###

    sp4_beards_mena = { 
        dna_modifiers = {
            accessory = {
                mode = add
                gene = beards
                template = sp4_mena_beards
                range = { 0 1 } # For the randomness to work correctly
            }
        }   
        weight = {
            base = 0
            modifier = {
                add = 30
                portrait_mena_clothing_trigger = yes
                has_sp4_dlc_trigger = yes
            }
            modifier = {
                add = 30
                portrait_turkic_clothing_trigger = yes
                has_sp4_dlc_trigger = yes
            }
            modifier = {
                factor = 0
                NOR = {
                    has_gene = {
                        category = gene_hair_type
                        template = hair_straight
                    }
                    has_gene = {
                        category = gene_hair_type
                        template = hair_straight_thin_beard
                    }
                    has_gene = {
                        category = gene_hair_type
                        template = hair_wavy
                    }
                    has_gene = {
                        category = gene_hair_type
                        template = hair_curly
                    }
                }
            }
        }
    }

    sp4_beards_rus = { 
        dna_modifiers = {
            accessory = {
                mode = add
                gene = beards
                template = sp4_rus_beards
                range = { 0 1 } # For the randomness to work correctly
            }
        }   
        weight = {
            base = 0
            modifier = {
                add = 50
                portrait_rus_clothing_trigger = yes
                has_sp4_dlc_trigger = yes
            }
            modifier = {
                add = 20
                portrait_turkic_clothing_trigger = yes
                has_sp4_dlc_trigger = yes
            }
            modifier = {
                factor = 0
                NOR = {
                    has_gene = {
                        category = gene_hair_type
                        template = hair_straight
                    }
                    has_gene = {
                        category = gene_hair_type
                        template = hair_straight_thin_beard
                    }
                    has_gene = {
                        category = gene_hair_type
                        template = hair_wavy
                    }
                }
            }
        }
    }


    # Shogunate

    japanese_generic = {
        dna_modifiers = {
            accessory = {
                mode = add
                gene = beards
                template = japanese_beards
                range = { 0 1 } # For the randomness to work correctly
            }
        }   
        # outfit_tags = { no_clothes }
        weight = {
            base = 0
            modifier = {
                add = 100
                OR = {
                    NOT = { exists = this }
                    has_gene = {
                        category = gene_hair_type
                        template = hair_straight
                    }       
                    has_gene = {
                        category = gene_hair_type
                        template = hair_wavy
                    }            
                    has_gene = {
                        category = gene_hair_type
                        template = hair_curly
                    }            
                }
                OR = {
                    portrait_yamato_clothing_trigger = yes
                    portrait_ryukyu_clothing_trigger = yes
                }
                exists = dynasty
            }
            modifier = { # Muslims should always have a beard
                add = 200
                scope:faith.religion = religion:islam_religion
                OR = {
                    portrait_yamato_clothing_trigger = yes
                    portrait_ryukyu_clothing_trigger = yes
                }
                exists = dynasty
            }
            modifier = {
                add = -100
                exists = this
                OR = {
                    is_from_ruler_designer = yes
                    has_character_flag = has_scripted_appearance
                }
            }
        }
    }
    
    japanese_straight = {
        dna_modifiers = {
            accessory = {
                mode = add
                gene = beards
                template = japanese_beards
                range = { 0 1 } # For the randomness to work correctly
            }
        }   
        # outfit_tags = { no_clothes }
        weight = {
            base = 0
            modifier = {
                add = 100
                OR = {
                    portrait_yamato_clothing_trigger = yes
                    portrait_ryukyu_clothing_trigger = yes
                }
                exists = dynasty
            }
            modifier = { # Muslims should always have a beard
                add = 200
                scope:faith.religion = religion:islam_religion
                OR = {
                    portrait_yamato_clothing_trigger = yes
                    portrait_ryukyu_clothing_trigger = yes
                }
                exists = dynasty
            }
            modifier = {
                add = -100
                exists = this
                OR = {
                    is_from_ruler_designer = yes
                    has_character_flag = has_scripted_appearance
                }
            }
        }
    }

    japanese_common = {
        dna_modifiers = {
            accessory = {
                mode = add
                gene = beards
                template = japanese_beards_common
                range = { 0 1 } # For the randomness to work correctly
            }
        }
        # outfit_tags = { no_clothes }
        weight = {
            base = 0
            modifier = {
                add = 100
                OR = {
                    NOT = { exists = this }
                    has_gene = {
                        category = gene_hair_type
                        template = hair_straight
                    }       
                    has_gene = {
                        category = gene_hair_type
                        template = hair_wavy
                    }            
                    has_gene = {
                        category = gene_hair_type
                        template = hair_curly
                    }            
                }
                OR = {
                    portrait_yamato_clothing_trigger = yes
                    portrait_ryukyu_clothing_trigger = yes
                }
                NOT = { exists = dynasty }
            }
            modifier = { # Muslims should always have a beard
                add = 200
                scope:faith.religion = religion:islam_religion
                OR = {
                    portrait_yamato_clothing_trigger = yes
                    portrait_ryukyu_clothing_trigger = yes
                }
                NOT = { exists = dynasty }
            }
            modifier = {
                add = -100
                exists = this
                OR = {
                    is_from_ruler_designer = yes
                    has_character_flag = has_scripted_appearance
                }
            }
        }
    }

    japanese_common_straight = {
        dna_modifiers = {
            accessory = {
                mode = add
                gene = beards
                template = japanese_beards_common
                range = { 0 1 } # For the randomness to work correctly
            }
        }   
        # outfit_tags = { no_clothes }
        weight = {
            base = 0
            modifier = {
                add = 100
                OR = {
                    portrait_yamato_clothing_trigger = yes
                    portrait_ryukyu_clothing_trigger = yes
                }
                NOT = { exists = dynasty }
            }
            modifier = { # Muslims should always have a beard
                add = 200
                scope:faith.religion = religion:islam_religion
                OR = {
                    portrait_yamato_clothing_trigger = yes
                    portrait_ryukyu_clothing_trigger = yes
                }
                NOT = { exists = dynasty }
            }
            modifier = {
                add = -100
                exists = this
                OR = {
                    is_from_ruler_designer = yes
                    has_character_flag = has_scripted_appearance
                }
            }
        }
    }
    
    ainu_generic = {
        dna_modifiers = {
            accessory = {
                mode = add
                gene = beards
                template = ainu_beards
                range = { 0 1 } # For the randomness to work correctly
            }
        }   
        # outfit_tags = { no_clothes }
        weight = {
            base = 0
            modifier = {
                add = 100
                OR = {
                    NOT = { exists = this }
                    has_gene = {
                        category = gene_hair_type
                        template = hair_straight
                    }       
                    has_gene = {
                        category = gene_hair_type
                        template = hair_wavy
                    }            
                    has_gene = {
                        category = gene_hair_type
                        template = hair_curly
                    }            
                }
                portrait_ainu_clothing_trigger = yes
            }
            modifier = { # Muslims should always have a beard
                add = 200
                scope:faith.religion = religion:islam_religion
                portrait_ainu_clothing_trigger = yes
            }
            modifier = {
                add = -100
                exists = this
                OR = {
                    is_from_ruler_designer = yes
                    has_character_flag = has_scripted_appearance
                }
            }
        }
    }

    ainu_straight = {
        dna_modifiers = {
            accessory = {
                mode = add
                gene = beards
                template = ainu_beards
                range = { 0 1 } # For the randomness to work correctly
            }
        }   
        # outfit_tags = { no_clothes }
        weight = {
            base = 0
            modifier = {
                add = 100
                portrait_ainu_clothing_trigger = yes
            }
            modifier = { # Muslims should always have a beard
                add = 200
                scope:faith.religion = religion:islam_religion
                portrait_ainu_clothing_trigger = yes
            }
            modifier = {
                add = -100
                exists = this
                OR = {
                    is_from_ruler_designer = yes
                    has_character_flag = has_scripted_appearance
                }
            }
        }
    }
}





